import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class demo01 {



    @Test
    public void test1(){
        int[] myArray = { 1, 2, 3 };
        List myList = Arrays.asList(myArray);
        System.out.println(myList.size());//1
        System.out.println(myList.get(0));//数组地址值
//        System.out.println(myList.get(1));//报错：ArrayIndexOutOfBoundsException
        int [] array=(int[]) myList.get(0);
        System.out.println(array[0]);//1
    }



    @Test
    public void test2(){
        List list = new ArrayList<>(Arrays.asList(1111));

        System.out.println(list);
    }


    @Test
    public void test3(){
        List<String> list = new ArrayList<>(Arrays.asList( "dog", "lazy", "a", "over", "jumps", "fox", "brown", "quick", "A"));
        Collections.reverse(list);
        System.out.println(list);

        String[] strings = list.toArray(new String[0]);
        for (String string : strings) {
            System.out.println(string);
        }

    }
}
